import { App } from 'vue';
import layout from '@/components/layout/index.vue';
import baseRouter, { setupBaseRouter } from '@/utils/baseRouter';
import index from '../views/index/index.vue';
import user from '../views/user/index.vue'
/**
 * @description meta 
 * @param title 标题
 * @param tabbar 是否显示navbar false或者{id:''}//映射layout的tabbar
 * @param navbar 是否显示导航栏 boolean
 * @param permissions 权限 [];具体要看float组件和navBarRight组件的配置
 * @param others 额外不重要的参数
 */
//uniapp 
export const routes: any = [
  {
    path: '/',
    name: 'Layout_tabbar',
    redirect: '/',
    component: layout,
    meta: {
      title: '首页',
      tabbar: false,
      navbar: false
    },
    children: [
      {
        path: '/',
        name: 'index',
        component: index,
        meta: {
          title: '首页',
          isHome: true,
          icon: 'home-o',
          tabbar: {id:'001'},
          permissions: ['scan']
        }
      },
      {
        path: '/user',
        name: 'user',
        component: user,
        meta: {
          title: '我的',
          isHome: false,
          icon: 'home-o',
          tabbar: {id:'002'},
          permissions: ['nfc']
        }
      }
    ]
  }
]
//uniapp
export function setupRouter (app: App) {
  routes.forEach(item=>{
    baseRouter.addRoute(item);
  })
  setupBaseRouter(app)
}
